package com.hu.zhcc.shiro.service.dingming;

import com.hu.zhcc.common.entity.Page;
import com.hu.zhcc.common.entity.PageRequest;
import com.hu.zhcc.shiro.dao.dingming.InterventionMiddleMapper;
import com.hu.zhcc.shiro.entity.dingming.InterventionMiddleClass;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class InterventionMiddleServiceImpl implements InterventionMiddleService{
    @Autowired
    private InterventionMiddleMapper interventionMiddleMapper;


    @Override
    public Page<InterventionMiddleClass> listInterpose(Map<String, Object> parameters, int offset, int limit) {
        int total = interventionMiddleMapper.countInterpose(parameters);
        List<InterventionMiddleClass> interventions = null;
        if (total > 0) {
            PageRequest pageRequest = new PageRequest(offset, limit, parameters);
            interventions = interventionMiddleMapper.listInterpose(pageRequest);
        }
        return new Page<InterventionMiddleClass>(total, interventions);
    }
}
